import jakarta.servlet.ServletException;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

/**
 * @author 86187
 * @classname SercletA
 * @time 2024/4/1
 * @project javaweb_project
 */
public class ServletA extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doGet(req, resp);
        Cookie cookie=new Cookie("username","zhangsan");
        cookie.setMaxAge(5000);
        resp.addCookie(cookie);
    }

}


